package com.study.util;

/**
 * @ClassName: ResponseUtil 统一响应
 * @Author: wYin
 * @Date: 2022/2/10 20:10
 */
public class ResponseResult<T> {
    private Integer code;
    private String message;
    private T data;

    public ResponseResult() {
    }

    public ResponseResult(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public ResponseResult(Integer code, String message){
        this.code = code;
        this.message = message;
    }

    public ResponseResult(T data){
        this.code = 200;
        this.message = "成功";
        this.data = data;
    }

    public static ResponseResult<Void> SUCCESS = new ResponseResult<>(200,"成功");

    public static ResponseResult<Void> FAIL  = new ResponseResult<>(400,"失败");
}
